package core1.ch05extends;
class A {
	static float f1=3.0f;
	public A() {
		System.out.println("A");
	}
	int a = 1;
	String d = "2.0";

	void show() {
		System.out.println("Class A: a=" + a + " d=" + d);
	}
}

public class B extends A {
	float f1=5.0f;
	public B() {
		System.out.println("B");
	}

	//float a = 3.0f;
	int a =2;
	int c=5;
	String d = "java prog";

	void show() {
		//super.show();
		System.out.println("Class B show(): a=" + a + " d=" + d+" c=" + c );
		System.out.println("Class B show(): f1=" + f1);
	}
	
	void show2() {
		//super.show();
		System.out.println("Class B show2(): a=" + a + " d=" + d+" c=" + c );
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		A classb=new B();
		System.out.println("classb.a= "+classb.a);
		System.out.println("classb.d= "+classb.d);
		classb.show();//向下转型
		
		//A.f1++;
		System.out.println("A.f1==classb.f1: "+(A.f1==classb.f1)+" A.f1= "+A.f1);
			
		//System.out.println(classb.c);	error	
		//classb.show2(); error
	}

}
